#!/bin/bash

OUTPUTDIR=out/
THEODIR=theo/
BINDIR=../bin/
BINNAME=analyseDTD
FILEFILTER=*.dtd

pass=0
fail=0

# Testing the presence of the binary file
ls $BINDIR/$BINNAME > /dev/null && echo "Exécutable trouvé" || echo -e '\E[01;31m'"\033[1mImpossible de trouver l'exécutable\E[0m\n"

for f in `ls $FILEFILTER` 
do
	echo "=== File: $f ==="
	$BINDIR/$BINNAME < $f 2> /dev/null && ((pass += 1)) || ((fail += 1))
	echo
done

echo -e "\n==== Summary ===="
echo -en '\E[01;32m'"\033[1mPass: $pass\E[0m"
echo -en " "
echo -en '\E[01;31m'"\033[1mFail: $fail\E[0m\n"

#for f in `ls $OUTPUTDIR` 
#do
#	echo "=== File: $f ==="
#	tail -n 1 $f
#	$BINDIR analyseDTD 
#done
